package org.springframework.data.mybatis.repository.config;

import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.data.repository.config.RepositoryBeanDefinitionParser;
import org.w3c.dom.Element;

public class MybatisRepositoryBeanDefinitionParser extends RepositoryBeanDefinitionParser {

	private MybatisRepositoryConfigExtension extension;

	public MybatisRepositoryBeanDefinitionParser(MybatisRepositoryConfigExtension extension) {
		super(extension);
		this.extension = extension;
	}

	@Override
	public BeanDefinition parse(Element element, ParserContext parser) {
		extension.setResourceLoader(parser.getReaderContext().getResourceLoader());// 设置资源载入器
		return super.parse(element, parser);
	}

}
